﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class DdlBind
    {
        Connect cn = new Connect();
        SqlConnection con = new SqlConnection();
        public DataSet TeacherBind()
        {
            string sql = "select distinct * from Teacher ";
            con = cn.ConnectDatabase();
            try
            {
                con.Open();
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(sql, con);
                //should check the repeated data before fill
                da.Fill(ds, "Teacher");
                return ds;
            }
            finally
            {
                con.Close();
            }

        }

        public DataSet LevelBind()
        {
            string sql = "select distinct * from Level";
            con = cn.ConnectDatabase();
            try
            {
                con.Open();
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(sql, con);
                da.Fill(ds, "Level");
                return ds;
            }
            finally
            {
                con.Close();
            }


        }

        public DataSet StatusBind()
        {
            string sql = "select * from Course";
            con = cn.ConnectDatabase();
            try
            {
                con.Open();
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(sql, con);
                da.Fill(ds, "Course");
                return ds;
            }
            finally
            {
                con.Close();
            }

        }

    }
}
